<template>
  <div class="blog-breadcrumb-bar">
    <!-- 左侧：面包屑导航 -->
    <div class="breadcrumb-left">
      <el-breadcrumb :separator-icon="ArrowRight">
        <el-breadcrumb-item v-for="(item, index) in breadcrumb" :key="index"
                            :to="item.path ? { path: item.path } : undefined"
                            :class="{ 'is-last': index === breadcrumb.length - 1 }">
          <span class="breadcrumb-title">{{ item.title }}</span>
        </el-breadcrumb-item>
      </el-breadcrumb>
    </div>

    <!-- 右侧：链接 -->
    <div class="quick-links">
      <el-link v-for="link in quickLinks" :key="link.name" :href="link.url" type="primary" class="black">
        {{ link.name }}
      </el-link>
    </div>
  </div>
</template>

<script setup>
import {ArrowRight} from "@element-plus/icons-vue";
import {useRoute} from 'vue-router'
import {computed} from "vue";

const route = useRoute()

// 支持 string 或 { title, path } 结构

const breadcrumb = computed(() => route.meta.breadcrumb || [])

const quickLinks = [
  {name: '文章列表', url: '/articles/'},
  {name: '相册', url: '/gallery'},
  {name: '音乐', url: '/music'},
  {name: '视频', url: '/videos'},
  {name: '每日云图', url: '/cloud-map'}
]
</script>

<style scoped>


/*面包屑 */
.blog-breadcrumb {
  margin: 0 auto;
  padding: 12px 20px;
  border-radius: 5px;

  border: 1px solid #ebeef5;
  box-sizing: border-box;

}


.el-breadcrumb__item .breadcrumb-title {
  font-weight: normal;
}

.el-breadcrumb__item.is-last .breadcrumb-title {
  font-weight: bold;
}


.blog-breadcrumb-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background-color: #fff;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  margin-bottom: 20px;
}

.breadcrumb-left {
  flex: 1;
}

.quick-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.black {
  color: #000;
}
</style>
